package com.czd.support.service;

import com.czd.base.service.BaseService;
import com.czd.support.model.Certification;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 * Author: Jerry.hu
 * Create: Jerry.hu (14-9-2 23:22)
 * Description:实名认证的业务操作
 */
@Service
public class CertificationService extends BaseService<Certification> {
	/**
	 * 插入实名认证的信息
	 * @param certification 实名认证的实体类
	 * @return boolean 操作成功true 失败false
	 */
	public boolean insert(Certification certification){
		return  this.insert(sqlId("insert"),certification);
	}

	/**
	 * 更新实名认证的信息
	 * @param certification 实名认证的实体类
	 * @return boolean 操作成功 true 失败false
	 */
	public boolean update(Certification certification){
		return this.update(sqlId("update"),certification);
	}

	/**
	 * 鏍规嵁鐢ㄦ埛id 鑾峰彇鐢ㄦ埛鏄槢璁よ瘉鐨勪俊鎭�
	 * @param userId
	 * @return
	 */
	public Certification findByUserId(int userId) {
		return this.selectOne(sqlId("findByUserId"),userId);
	}

	/**
	 * 审核通过
	 * @param certification
	 * @return
	 */
	public boolean audit(Certification certification) {
		return this.update(sqlId("audit"),certification);
	}
}
